namespace Jumpton.SFA.Server.Entity {
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Jumpton.Persistent;
    using System.Data;
    using System.Runtime.Serialization;
    
    
    [System.SerializableAttribute()]
    [Map("Sys_USER_roleS")]
    public class UserRole : ObjectRow {
        
        public UserRole() {
        }
        
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">DataTable 中的一行数据</param>
        /// <param name="objectTable">存储当前对象的数据表格</param>
        public UserRole(System.Data.DataRow dataRow, ObjectTable parent) : 
                base(dataRow, parent) {
        }
        
        /// <summary>
        /// 供反序列化使用的构造函数
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected UserRole(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
                base(info, context) {
        }
        
        [Key("sequence_no",true,true)]
        public decimal ID {
            get {
                return (System.Decimal)GetValue("ID");
            }
            set {
                SetValue("ID", value);
            }
        }


        [Field("User_ID")]
        public decimal UserID
        {
            get
            {
                return (System.Decimal)GetValue("UserID");
            }
            set
            {
                SetValue("UserID", value);
            }
        }


        [Field("Role_NO")]
        public decimal RoleNo
        {
            get
            {
                return (System.Decimal)GetValue("RoleNo",-1);
            }
            set
            {
                SetValue("RoleNo", value);
            }
        }

        [CalculateField]
        public USER_GROUPS Role
        {
            get
            {  
                var var = (USER_GROUPS)ObjectRow.Load(typeof(USER_GROUPS), "this.ID=" + RoleNo.ToString());
                if (var != null)
                    return var;
                return null;
            }
           
        }
      

        /// <summary>
        /// 是否有效
        /// </summary>
        [Field("ACTIVE")]
        public Boolean ACTIVE
        {
            get
            {
                return (System.Boolean)GetValue("ACTIVE");
            }
            set
            {
                SetValue("ACTIVE", value);
            }
        }

        /// <summary>
        /// 是否有效
        /// </summary>
        [Field("Is_Lock")]
        public Boolean IsLock
        {
            get
            {
                return (System.Boolean)GetValue("IsLock");
            }
            set
            {
                SetValue("IsLock", value);
            }
        }




        [Field("LAST_UPDATER")]
        public string LAST_UPDATER {
            get {
                return (System.String)GetValue("LAST_UPDATER");
            }
            set {
                SetValue("LAST_UPDATER", value);
            }
        }

        [Field("LAST_UPDATE_TIME")]
        public decimal LAST_UPDATE_TIME {
            get {
                return (decimal)GetValue("LAST_UPDATE_TIME");
            }
            set {
                SetValue("LAST_UPDATE_TIME", value);
            }
        }
    }
}
